import sys


def count(board, color):
    visit = [[0] * 19 for _ in range(19)]
    res = 0
    
    def bfs(x, y):
        count = 0
        queue = [(x, y)]
        for i, j in queue:
            if not visit[i][j] and board[i][j] == color:
                visit[i][j] = 1
                count += 1
                if i-1>=0: queue.append((i-1, j))
                if i+1<19: queue.append((i+1, j))
                if j-1>=0: queue.append((i, j-1))
                if j+1<19: queue.append((i, j+1))
        return count
        
    for i in range(19):
        for j in range(19):
            if board[i][j] == color and visit[i][j] == 0:
                count = bfs(i, j)
                res = max(count, res)
    return res


if __name__ == "__main__":
    # board = []
    # for i in range(19):
    #     line = sys.stdin.readline().strip()
    #     board.append(list(map(int, line.split(' '))))
    
    lines = ["1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 2",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 2 2 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",
            "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0",]

    board = []
    for line in lines:
        board.append(list(map(int, line.split(' '))))
    
    white = count(board, 1)
    black = count(board, 2)
    print("white", white)
    print("black", black)
    
    if white == black:
        print("equal")
    elif white > black:
        print("white")
    else:
        print("black")
